// Done without simultaneous move. (define "Columns" 7) (define "RightMostEmpty" (trackSite FirstSite from:(mapEntry "RightMost" Mover) if:(is Empty (to)) ) ) (define "PlayableSites" (sites (values Remembered "Playable"))) (define "NoPieceOnBoard" (all Sites (union (sites Top) (sites Bottom)) if:(is Empty (site)))) //------------------------------------------------------------------------------ (game "Papan Dakon" (players 2) (equipment { (mancalaBoard 2 "Columns" { (track "Track1" "0,8,E,S,W" loop:True P1) (track "Track2" "15,7,W,N,E" loop:True P2) } ) (piece "Seed" Shared) (regions P1 (sites Bottom)) // P1 home (regions P2 (sites Top)) // P2 home (map {(pair P1 FirstSite) (pair P2 LastSite)}) // kalahs (storage pits) (map "RightMost" {(pair P1 7) (pair P2 8)}) }) (rules (start { (set Count 7 to:(union (sites P1) (sites P2))) (set RememberValue "Playable" (union (sites Top) (sites Bottom))) }) phases:{ (phase "Sowing" (play (or (move Select (from (if ("SameTurn") "LastHoleSowed" (sites Mover) ) if:(and (> (count at:(from)) 0) (is In (from) ("PlayableSites"))) ) (then (sow "Track" owner:(mover) apply:(if (and (!= (to) (mapEntry Mover)) (< 1 (count at:(to)))) (moveAgain) ) skipIf:(if (!= (to) (mapEntry Mover)) (not (is In (to) ("PlayableSites")))) ) ) ) (if (and (is In (last To afterConsequence:True) (sites Mover)) ("SameTurn")) (if (is In (last To afterConsequence:True) ("PlayableSites")) (move (from (last To afterConsequence:True)) (to ("OppositePit" (last To afterConsequence:True))) count:1 (then (fromTo (from (last To)) (to (mapEntry Mover)) count:(count at:(last To)) ) ) ) ) ) (then (if ("NoPieceOnBoard") (forget Value "Playable" All))) ) ) (end (if ("NoPieceOnBoard") { (if (> 7 (count at:(mapEntry P1))) (result P2 Win)) (if (> 7 (count at:(mapEntry P2))) (result P1 Win)) } ) ) (nextPhase ("NoPieceOnBoard") "BetweenRounds") ) (phase "BetweenRounds" (play (if (not (all Sites (sites Mover) if:(is Occupied (site)))) (if (<= 7 (count at:(mapEntry Mover))) (move (from (mapEntry Mover)) (to "RightMostEmpty") count:7 (then (remember Value "Playable" (last To))) ) ) ) ) (nextPhase (all Passed) "Sowing") ) } ) ) //------------------------------------------------------------------------------ (metadata (info { (description "Papan Dakon is a two-row mancala-style board game from Borneo. It is one of many games that are similar throughout southeast Asia.") (rules "2x7 board, with one store at either end. Each player owns the store to their left. Seven counters in each hole. The first turn is played simultaneously by both players; at the point which one player's sowing lasts longer than the others, the player whose turn was shorter plays next and turns alternate from this point. Players sow in a clockwise direction from one of the holes in their row, also sowing into their store, but not in their opponent's store. When the final counter lands in an empty hole or in the store, the turn ends. When the final counter falls into an occupied hole, the player picks up the contents of this hole and continues to sow. If this occupied hole is in the player's row, they have the option to instead place the final counter in the opposite hole in the opponent's row, and to place this last counter as well as the contents of that hole into the store. When all of the counters are in the stores, a new game begins. The players take the counters from their stores and place seven in each hole, beginning from their right. Any player which cannot fill a hole with seven counters places the remaining counters in their store. Any holes which are left empty are out of play for this game. Play continues as before. Multiple games are played like this until all of the holes on one side are left empty. This player loses.") (source "BĂ©art 1955: 505-507.") (id "289") (version "1.3.12") (classification "board/sow/two rows") (credit "Eric Piette") } ) (graphics { (board Style Mancala) }) (ai "Papan Dakon_ai" ) )